package com.yulang.security.pojo;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.beans.BeanUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

/**
 * <p>
 * 系统-用户表
 * </p>
 *
 * @author Administrator
 * @since 2020-08-02
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("cloud_user")
public class CloudUser implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @TableId(value = ID, type = IdType.AUTO)
    private Long id;

    /**
     * 账号
     */
    @TableField(ACCOUNT_NAME)
    private String accountName;

    /**
     * 密码
     */
    @TableField(PASS_WORD)
    private String passWord;

    /**
     * 姓名
     */
    @TableField(REAL_NAME)
    private String realName;

    /**
     * 0:男 1:女
     */
    @TableField(SEX)
    private String sex;

    /**
     * 手机
     */
    @TableField(TEL)
    private String tel;

    /**
     * Email
     */
    @TableField(EMAIL)
    private String email;

    /**
     * 头像
     */
    @TableField(PHOTO)
    private String photo;

    /**
     * 是否锁定
     */
    @TableField(IS_LOCK)
    private String isLock;

    /**
     * 盐值
     */
    @TableField(PWD_SALT)
    private String pwdSalt;

    /**
     * token
     */
    @TableField(LOGIN_TOKEN)
    private String loginToken;

    /**
     * 创建时间
     */
    @TableField(CREATE_TIME)
    private Date createTime;

    /**
     * 更新时间
     */
    @TableField(UPDATE_TIME)
    private Date updateTime;

    /**
     * 创建者
     */
    @TableField(CREATE_USER)
    private String createUser;

    /**
     * 最后登录时间
     */
    @TableField(LAST_LOGIN_TIME)
    private Date lastLoginTime;

    /**
     * 更新者
     */
    @TableField(UPDATE_USER)
    private String updateUser;


    public static final String ID = "`id`";

    public static final String ACCOUNT_NAME = "`account_name`";

    public static final String PASS_WORD = "`pass_word`";

    public static final String REAL_NAME = "`real_name`";

    public static final String SEX = "`sex`";

    public static final String TEL = "`tel`";

    public static final String EMAIL = "`email`";

    public static final String PHOTO = "`photo`";

    public static final String IS_LOCK = "`is_lock`";

    public static final String PWD_SALT = "`pwd_salt`";

    public static final String LOGIN_TOKEN = "`login_token`";

    public static final String CREATE_TIME = "`create_time`";

    public static final String UPDATE_TIME = "`update_time`";

    public static final String CREATE_USER = "`create_user`";

    public static final String LAST_LOGIN_TIME = "`last_login_time`";

    public static final String UPDATE_USER = "`update_user`";


    public static final String ID_COMMENT = "id";

    public static final String ACCOUNT_NAME_COMMENT = "账号";

    public static final String PASS_WORD_COMMENT = "密码";

    public static final String REAL_NAME_COMMENT = "姓名";

    public static final String SEX_COMMENT = "0:男 1:女";

    public static final String TEL_COMMENT = "手机";

    public static final String EMAIL_COMMENT = "Email";

    public static final String PHOTO_COMMENT = "头像";

    public static final String IS_LOCK_COMMENT = "是否锁定";

    public static final String PWD_SALT_COMMENT = "盐值";

    public static final String LOGIN_TOKEN_COMMENT = "token";

    public static final String CREATE_TIME_COMMENT = "创建时间";

    public static final String UPDATE_TIME_COMMENT = "更新时间";

    public static final String CREATE_USER_COMMENT = "创建者";

    public static final String LAST_LOGIN_TIME_COMMENT = "最后登录时间";

    public static final String UPDATE_USER_COMMENT = "更新者";



    public static CloudUser of(Object obj) {
        CloudUser e = new CloudUser();
        BeanUtils.copyProperties(obj, e);
        return e;
    }

    public static QueryWrapper<CloudUser> queryWrapper(Object obj) {
        return new QueryWrapper<>(of(obj));
    }

}
